All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.JProgressBar

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----com.sun.java.swing.JComponent
                           |
                           +----com.sun.java.swing.JProgressBar

public class JProgressBar
extends JComponent
implements SwingConstants, Accessible
A component that displays an integer value graphically within a bounded interval. A progress bar typically communicates the progress of an event by displaying its percentage of completion. The orientation of the progress bar depends on its size. If its height is greater than its width, the progress bar is vertical.

Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.


Variable Index

 o barModel
 o changeEvent
Only one ChangeEvent is needed per instance since the event's only interesting property is the immutable source, which is the progress bar.
 o changeListener
 o orientation
 o paintBorder

Constructor Index

 o JProgressBar()
Creates a horizontal progress bar with a border.

Method Index

 o addChangeListener(ChangeListener)
Adds a ChangeListener to the button.
 o createChangeListener()
 o fireStateChanged()
Notify all listeners that have registered interest for notification on this event type.
 o getAccessibleContext()
Get the AccessibleContext associated with this JComponent
 o getMaximum()
Returns the model's maximum value.
 o getMinimum()
Returns the model's minimum value.
 o getModel()
Returns the data model used by the JProgressBar.
 o getOrientation()
Returns JProgressBar.VERTICAL or JProgressBar.HORIZONTAL, depending on the orientation of the progress bar.
 o getUI()
Returns the L&F object that renders this component.
 o getUIClassID()
Returns the name of the L&F class that renders this component.
 o getValue()
Returns the model's current value.
 o isBorderPainted()
Returns true if the progress bar has a border or false if it does not.
 o paintBorder(Graphics)
Paint the progress bar's border if BorderPainted property is true.
 o removeChangeListener(ChangeListener)
Removes a ChangeListener from the button.
 o setBorderPainted(boolean)
Sets whether the progress bar should have a border.
 o setMaximum(int)
Sets the model's maximum to x.
 o setMinimum(int)
Sets the model's minimum to x.
 o setModel(BoundedRangeModel)
Sets the data model used by the JProgressBar.
 o setOrientation(int)
Sets the progress bar's orientation to newOrientation, which must be JProgressBar.VERTICAL or JProgressBar.HORIZONTAL.
 o setUI(ProgressBarUI)
Sets the L&F object that renders this component.
 o setValue(int)
Sets the model's current value to x.
 o update(Graphics)
Overridden to call paint without filling the background.
 o updateUI()
Notification from the UIFactory that the L&F has changed.

Variables

 o orientation
 protected int orientation
 o paintBorder
 protected boolean paintBorder
 o barModel
 protected BoundedRangeModel barModel
 o changeEvent
 protected transient ChangeEvent changeEvent
Only one ChangeEvent is needed per instance since the event's only interesting property is the immutable source, which is the progress bar.

 o changeListener
 protected ChangeListener changeListener

Constructors

 o JProgressBar
 public JProgressBar()
Creates a horizontal progress bar with a border.

Methods

 o update
 public void update(Graphics g)
Overridden to call paint without filling the background.

Overrides:
update in class JComponent
 o getOrientation
 public int getOrientation()
Returns JProgressBar.VERTICAL or JProgressBar.HORIZONTAL, depending on the orientation of the progress bar. The default orientation is HORIZONTAL.

Returns:
HORIZONTAL or VERTICAL
 o setOrientation
 public void setOrientation(int newOrientation)
Sets the progress bar's orientation to newOrientation, which must be JProgressBar.VERTICAL or JProgressBar.HORIZONTAL. The default orientation is HORIZONTAL.

Parameters:
newOrientation - HORIZONTAL or VERTICAL
Throws: IllegalArgumentException
if newOrientation is an illegal value
 o isBorderPainted
 public boolean isBorderPainted()
Returns true if the progress bar has a border or false if it does not.

Returns:
whether the progress bar has a border
See Also:
setBorderPainted
 o setBorderPainted
 public void setBorderPainted(boolean b)
Sets whether the progress bar should have a border.

Parameters:
b - true if the progress bar should have a border
See Also:
isBorderPainted
 o paintBorder
 protected void paintBorder(Graphics g)
Paint the progress bar's border if BorderPainted property is true.

Parameters:
g - the Graphics context within which to paint the border
Overrides:
paintBorder in class JComponent
See Also:
paint, setBorder
 o getUI
 public ProgressBarUI getUI()
Returns the L&F object that renders this component.

Returns:
the ProgressBarUI object that renders this component
 o setUI
 public void setUI(ProgressBarUI ui)
Sets the L&F object that renders this component.

Parameters:
ui - the ProgressBarUI L&F object
See Also:
getUI
 o updateUI
 public void updateUI()
Notification from the UIFactory that the L&F has changed. Called to replace the UI with the latest version from the UIFactory.

Overrides:
updateUI in class JComponent
See Also:
updateUI
 o getUIClassID
 public String getUIClassID()
Returns the name of the L&F class that renders this component.

Returns:
"ProgressBarUI"
Overrides:
getUIClassID in class JComponent
See Also:
getUIClassID, getUI
 o createChangeListener
 protected ChangeListener createChangeListener()
 o addChangeListener
 public void addChangeListener(ChangeListener l)
Adds a ChangeListener to the button.

Parameters:
l - the ChangeListener to add
 o removeChangeListener
 public void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the button.

Parameters:
l - the ChangeListener to remove
 o fireStateChanged
 protected void fireStateChanged()
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

See Also:
EventListenerList
 o getModel
 public BoundedRangeModel getModel()
Returns the data model used by the JProgressBar.

Returns:
the BoundedRangeModel currently in use
See Also:
BoundedRangeModel
 o setModel
 public void setModel(BoundedRangeModel newModel)
Sets the data model used by the JProgressBar.

Parameters:
newModel - the BoundedRangeModel to use
See Also:
BoundedRangeModel
 o getValue
 public int getValue()
Returns the model's current value. The value is always between the model's minimum and maximum values, inclusive.

Returns:
the value
See Also:
setValue, BoundedRangeModel
 o getMinimum
 public int getMinimum()
Returns the model's minimum value.

Returns:
an int -- the model's minimum
See Also:
setMinimum, BoundedRangeModel
 o getMaximum
 public int getMaximum()
Returns the model's maximum value.

Returns:
an int -- the model's maximum
See Also:
setMaximum, BoundedRangeModel
 o setValue
 public void setValue(int n)
Sets the model's current value to x. If x is less than the minimum or greater than the maximum, this method throws an IllegalArgumentException and the value is not changed.

Notifies any listeners if the data changes.

Parameters:
x - the new value
See Also:
getValue, BoundedRangeModel
 o setMinimum
 public void setMinimum(int n)
Sets the model's minimum to x. If the maximum value or current value is outside of the new minimum, the maximum or current value is adjusted accordingly.

Notifies any listeners if the data changes.

Parameters:
x - the new minimum
See Also:
getMinimum, addChangeListener, BoundedRangeModel
 o setMaximum
 public void setMaximum(int n)
Sets the model's maximum to x. If the minimum value or current value is outside of the new maximum, the minimum or current value is adjusted accordingly.

Notifies any listeners if the data changes.

Parameters:
x - the new maximum
See Also:
getMaximum, addChangeListener, BoundedRangeModel
 o getAccessibleContext
 public AccessibleContext getAccessibleContext()
Get the AccessibleContext associated with this JComponent

Returns:
the AccessibleContext of this JComponent
Overrides:
getAccessibleContext in class JComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index